package com.jdls.work;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;

/**
 * @author 嘉德罗斯
 * @date 2021/8/29
 */
@WebServlet("/Servlet")
public class RegisterServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8"); // 处理请求参数的乱码
        response.setContentType("text/html;charset=utf-8"); // 处理响应数据的乱码
        User user = new User();
        String a = request.getParameter("username");
        System.out.println(a);
        //user.setUsername(request.getParameter("用户名"));
        //user.setName(request.getParameter("姓名"));
        //System.out.println(user);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }
}
